import build from "next/dist/build";

const residences = [
  {
    value: "community_1",
    label: "小区一",
    children: [
      {
        value: "building_first",
        label: "一号楼",
        children: [
          {
            value: "unit_first",
            label: "一单元",
          },
        ],
      },
    ],
  },
];

type Community = {
  label: string;
  value: string;
  children: Building;
};
type Building = {
  label: string;
  value: string;
  children: BuildingUnit;
};

type BuildingUnit = {
  label: string;
  value: string;
  children: BuildingUnitRoom;
};

type BuildingUnitRoom = {
  label: string;
  value: string;
};

export function geneResidence() {
  const residences = new Array();
  let room: BuildingUnitRoom;
  let unit: BuildingUnit;
  let building: Building;
  let community: Community;
// 
  for (const num in "一/二/三/四/五".split("/")) {
    room = {
      label: num + "号",
      value: num + "_room",
    };
    unit = {
      label: num + "单元",
      value: num + "_unit",
      children: room,
    };
    building = {
      label: num + "楼",
      value: num + "_building",
      children: unit,
    };
    community = {
      label: num + "小区",
      value: num + "_community",
      children: building,
    };
    residences.push(community);
  }
  return residences
}
